<?php
set_time_limit(0);
require_once("config.php");
require_once("functions.php");
$title = "Domain Age Tool";
require_once("header.php");
?>
<TABLE cellSpacing="2" cellPadding="2" width="98%" class="mytable">
<TBODY>
<TR>
  <TD><FORM action="domain_age.php" method="post">
	<p><strong>Enter one domain on each line of the box   below:</strong></p>
	<p>
	  <TEXTAREA name="domains" rows="10" cols="40"><?php 
	  if (!empty($_REQUEST['domains'])) {
		   echo $_REQUEST['domains'];
		} else {
	  echo 'mydomain.com
mycompetitor1.com
mycompetitor2.com
mycompetitor3.com'; } ?></TEXTAREA>
	</p>
	<INPUT type="hidden" value="submit" name="submit">
	<p>
	  <INPUT type="submit" value="submit" name="submit" class="button">
	</p>
  </FORM>
 </TD>
</TR>
</TBODY>
</TABLE>
<?php
if (!empty($_REQUEST['domains'])) {
	require_once("Request.php");

	$domains = explode("\n",$_REQUEST['domains']);
?>
<br>
<TABLE width="100%" border="0">
<TBODY>
  <TR class="headingbar" height="25">
	<TD><strong>No.</strong></TD>
	<TD align="center"><strong>Domain Name</strong></TD>
	<TD align="center"><strong>Age</strong></TD>
  </TR>
<?php
$no = 1;
foreach ( $domains as $domain ) {

	if (!empty($domain) ) {

		list($with_www, $without_domain) = get_domain($domain);
		$req = new Request($without_domain);
?>
  <TR class="tr<?php echo (($no % 2 != 0)?'1':'2'); ?>" height="22">
	<TD style="padding-left:4px"><?php echo $no++; ?></TD>
	<TD style="padding-left:8px"><?php echo $without_domain; ?></TD>
	<TD style="padding-left:8px"><?php echo $req->get_age(); ?></TD>
<?php
	}
}
?>
  </TR>
</TBODY>
</TABLE>
<br><br>
<?php
}
require_once("footer.php");
?>